const db = require("../../../db");

const addUser = (req, res) => {
  let { userId, friendId } = req.body;
  let sql = `insert into friendlist(userId,friendId) values('${userId}', '${friendId}')`;
  db.query(sql, (err, result) => {
    if (err) return res.send({ code: 2, message: err.message });
    if (result.affectedRows) {
      res.send({ code: 0, message: "添加成功" });
    } else {
      res.send({ code: 1, message: "添加失败" });
    }
  });
};

module.exports = addUser;
